import React from 'react'
import '@/pages/Home/css/Prederive/Prederive.css'
import { getShapeStyle } from '@/mock/style'

export default function Preview(props: any) {
    console.log(props, 'preview')
    //判断组件类型
    //文字 input
    if (props.element.component === "Dtext") {
        var content: any = <input placeholder={props.element.propLable} />
    }
    //button
    if (props.element.component === "drag-button") { 
        var content :any = <button>{props.element.lable} </button>
    }
    //图片
    if (props.element.component === "Dimg") {
        var content: any = <img src={props.element.propLable} alt="" style={{ pointerEvents: 'none' }} width={props.element.style.width} height={props.element.style.height} />
    }
    return (
        <div style={getShapeStyle(props.element.style)} className="preview" >
            {content}
        </div>
    )
}
